﻿<%@ Page Title="" Language="C#" MasterPageFile="~/administrator/Admin.Master" AutoEventWireup="true"
    CodeBehind="ApplicationManager.aspx.cs" Inherits="ServerApi.administrator.ApplicationManager" %>

<%@ Register Assembly="ASPnetPagerV2_8" Namespace="ASPnetControls" TagPrefix="cc1" %>
<%@ Register src="../../UtilityControl/CKFinderPicker.ascx" tagname="CKFinderPicker" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Title" runat="server">
    Quản lý ứng dụng
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Script" runat="server">
    <%--      <script type="text/javascript">
          $(document).ready(function () {
              $(".active").removeClass("active");
              var item = '1';
              $("#item" + item).addClass("active");
          });
    </script>--%>
    <style type="text/css">
        .style2
        {
            width: 177px;
        }
        .style3
        {
            width: 300px;
        }
        .style4
        {
            width: 100px;
        }
        .style6
        {
            width: 200px;
        }
        .style7
        {
            width: 164px;
        }
        .style8
        {
            width: 160px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <strong style="font-size: 18px; text-transform: uppercase">Quan ly ung dung</strong>
    </div>
    <br />
    <div>
        <strong>Tìm kiếm ứng dụng</strong>
    </div>
    <div>
        <table>
            <tr>
                <td class="style2">
                    Mã ứng dụng:
                </td>
                <td class="style3">
                    <asp:TextBox runat="server" ID="txtIdSearch" Width="150px"></asp:TextBox>
                </td>
                <td class="style4">
                    Tên ứng dụng:
                </td>
                <td class="style6">
                    <asp:TextBox runat="server" ID="txtNameSearch" Width="199px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Hệ điều hành
                </td>
                <td>
                    <asp:DropDownList ID="ddlPlatformSearch" runat="server">
                        <asp:ListItem Value="0">Tất cả</asp:ListItem>
                        <asp:ListItem Value="1">Android</asp:ListItem>
                        <asp:ListItem Value="2">IOS</asp:ListItem>
                        <asp:ListItem Value="3">WindowPhone</asp:ListItem>
                        <asp:ListItem Value="4">J2ME</asp:ListItem>
                        <asp:ListItem Value="5">WAP</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    Loại
                </td>
                <td>
                    <asp:DropDownList ID="ddlTypeSearch" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="Tìm kiếm" />
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <div style="margin: 10px 0px 4px 0px; border-top: solid 1px red;">
    </div>
    <div>
        <strong>
            <%=title%></strong>
    </div>
    <div>
        <table>
            <tr>
                <td class="style2">
                    Mã ứng dụng:
                </td>
                <td class="style3">
                    <asp:TextBox runat="server" ID="txtAppid" Width="150px"></asp:TextBox>
                </td>
                <td class="style4">
                    Tên ứng dụng:
                </td>
                <td class="style6">
                    <asp:TextBox runat="server" ID="txtName" Width="199px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Hệ điều hành
                </td>
                <td>
                    <asp:DropDownList ID="ddlPlatform" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPlatform_SelectedIndexChanged">
                        <asp:ListItem Value="1">Android</asp:ListItem>
                        <asp:ListItem Value="2">IOS</asp:ListItem>
                        <asp:ListItem Value="3">WindowPhone</asp:ListItem>
                        <asp:ListItem Value="4">J2ME</asp:ListItem>
                        <asp:ListItem Value="5">WAP</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    File Dll
                </td>
                <td>
                    <asp:DropDownList ID="ddlFileDll" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlFileDll_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td rowspan="3" class="style2">
                    Config
                </td>
                <td rowspan="3">
                    <asp:TextBox ID="txtConfig" runat="server" Height="135px" TextMode="MultiLine" Width="353px"></asp:TextBox>
                </td>
                <td>
                    Class Api
                </td>
                <td>
                    <asp:DropDownList ID="ddlClassApi" runat="server">
                    </asp:DropDownList>
                    <asp:Button ID="btnViewDescriptionClass" runat="server" OnClick="btnViewDescriptionClass_Click"
                        Text="Xem mô tả" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="btnGetLibrary" runat="server" OnClick="btnGetLibrary_Click" Text="Lấy file library" />
                </td>
            </tr>
            <tr>
                <td>
                    Developer
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtDeveloper" Width="199px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Loại
                </td>
                <td>
                    <asp:DropDownList ID="ddlType" runat="server">
                    </asp:DropDownList>
                    <asp:Button ID="btnAddTypeApp" runat="server" OnClick="btnAddTypeApp_Click" Text="Thêm Loại ứng dụng" />
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Có quảng cáo
                </td>
                <td>
                    <asp:DropDownList ID="ddlStatusAdvertise" runat="server">
                        <asp:ListItem Value="1">Có quảng cáo</asp:ListItem>
                        <asp:ListItem Value="0">Không quảng cáo</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:Panel ID="pnAndroid" runat="server">
                        <table style="width: 100%;">
                            <tr>
                                <td class="style7">
                                    Server Api Key:
                                </td>
                                <td class="style3">
                                    <asp:TextBox runat="server" ID="txtapikey" Width="321px"></asp:TextBox>
                                </td>
                                <td class="style4">
                                    Client Sender id
                                </td>
                                <td class="style6">
                                    <asp:TextBox runat="server" ID="txtsenderid" Width="199px"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Panel ID="pnIOS" runat="server" Visible="true">
                        <table style="width: 100%;">
                            <tr>
                                <td class="style8">
                                    File P12
                                </td>
                                <td class="style3">
                                    
                                    <uc1:CKFinderPicker ID="fmpFileP12" runat="server" />
                                    
                                </td>
                                <td class="style4">
                                    Pass File P12
                                </td>
                                <td class="style6">
                                    <asp:TextBox ID="txtPassP12" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="btnAccept" runat="server" OnClick="btnAccept_Click" Text="Đồng ý" />
                </td>
                <td>
                </td>
                <td style="width: 70px">
                </td>
            </tr>
        </table>
    </div>
    <div style="margin: 10px 0px 4px 0px; border-top: solid 1px red;">
    </div>
    <div style="width: 100%; text-align: center;">
        <cc1:PagerV2_8 ID="pager1" runat="server" OnCommand="pager1_Command" PageSize="50"
            BackToFirstClause="Trang đầu" BackToPageClause="trở lại trang" GoToLastClause="Trang cuối"
            MaxSmartShortCutCount="0" NextToPageClause="trang tiếp theo" OfClause="của" PageClause="Trang"
            ShowResultClause="Hiện kết quả" CssClass="style2" FirstClause="Trang đầu" GenerateFirstLastSection="True"
            LastClause="Trang cuối" />
        <div>
            <strong>Tổng:
                <%=count%></strong></div>
        <asp:GridView ID="GrvListApp" DataKeyNames="appid" Width="100%" runat="server" AutoGenerateColumns="False"
            PageSize="50" CellPadding="4" ForeColor="#333333" GridLines="Vertical" OnPageIndexChanging="GrvListApp_PageIndexChanging"
            OnRowDataBound="GrvListApp_RowDataBound" OnRowDeleting="GrvListApp_RowDeleting"
            EnableModelValidation="True" BorderWidth="1px" BorderStyle="Solid">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" HorizontalAlign="center" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:TemplateField HeaderText="STT">
                    <ItemTemplate>
                        <%=stt++ %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <input type="checkbox" id="chkAll" onclick="CheckUncheckAll('chk[]',this.checked);" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <input type="checkbox" id='chk' name="chk[]" value='<%# Eval("appid") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã ứng dụng">
                    <ItemTemplate>
                        <%#Eval("appid")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên ứng dụng">
                    <ItemTemplate>
                        <%#Eval("name")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Client Sender ID">
                    <ItemTemplate>
                        <%#Eval("sender_id")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Client Private_Key">
                    <ItemTemplate>
                        <%#Eval("private_key")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Class API">
                    <ItemTemplate>
                        <%#Eval("class_api")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Loại Ứng dụng">
                    <ItemTemplate>
                        <%#Eval("type_app_name")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Hệ điều hành">
                    <ItemTemplate>
                        <%#Eval("platform").ToString().Equals("1") ? "Android" : Eval("platform").ToString().Equals("2") ?"IOS":Eval("platform").ToString().Equals("3") ?"WindowPhone":Eval("platform").ToString().Equals("4") ?"J2ME":"WAP"%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ToolTip="Xóa" Font-Overline="false" ForeColor="#007FD3" Text="Xóa"
                            CommandArgument='<%#Eval("appid") %>' CommandName="Delete" ID="lbtnDel" runat="server">
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <a href='<%#Eval("appid","ApplicationManager.aspx?id={0}") %>'>Sửa</a>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <a href='<%#Eval("appid","DocumentApi.aspx?id={0}") %>'>Document Api</a>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
</asp:Content>
